<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        {{ msg }}
        <my-cpn></my-cpn>
        <my-cpn></my-cpn>
        <my-cpn></my-cpn>
        <my-cpn></my-cpn>
    </div>


    <script src="../js/vue.js"></script>
    <template id="myCpn">
        <div>
            {{ count }}
            <button @click="add">+1</button>
        </div>
    </template>
    <script>
        let obj = {
            count:0    //xb01
        }
        const app = new Vue({
            el:'#app',
            data:{
                msg:'我是data里面的内容'
            },
            components:{
                'my-cpn':{
                    template:'#myCpn',
                    data(){
                        // return obj //xb01
                        return {
                            count:0 
                        }
                    },
                    methods:{
                        add(){
                            this.count++
                        }
                    }
                }
            }
        })
    </script>
    <script>
        // let a = 1
        // let b = a
        // b = 345

        // let c = {
        //     name:'王发发'
        // }
        // let d = c
        // c.name = '王某人'
    </script>
</body>
</html>